# -*- coding: utf-8 -*-
# @Time    : 2023/10/10 21:21
# @Author  : yan.wei
# @Email   : 13675196684@163.com
# @File    : main2.py
# @Software: PyCharm


# 将2022-06-14的数据拆分成2022-06-14~2022-06-20，共七天数据
# 这样数据量会轻量化一些，用于实习

import pandas as pd

data = pd.read_csv(r'fact_epsfb_bigxdr_20220614-20220620.csv')

date_replace_mapping = {
    0: '2022-06-14',
    1: '2022-06-15',
    2: '2022-06-16',
    3: '2022-06-17',
    4: '2022-06-18',
    5: '2022-06-19',
    6: '2022-06-20'
    # ... （更多日期映射）
}

# 定义每个区间的大小
# interval_size = 40000
interval_size = int(len(data) / 7)

# 迭代处理
for i in range(len(date_replace_mapping)):
    start = i * interval_size
    end = (i + 1) * interval_size
    if end > len(data):
        end = len(data)

    date_to_replace = date_replace_mapping[i]

    data[start:end] = data[start:end].replace('2022-06-14', date_to_replace, regex=True)
# df4 = df4.replace(date_mapping, regex=True)

# 打印修改后的数据
data.to_csv(r'fact_epsfb_bigxdr.csv', index=False)
